package com.shawn.model.vo;

import com.shawn.model.entity.UserInfo;
import com.shawn.model.mongo.Sound;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

/**
 * @author shawn
 * @date 2022年 11月 11日 17:09
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SoundVo {
   private Integer id;
   private String avatar;
   private String nickname;
   private String gender;
   private Integer age;
   private String soundUrl;
   private Integer remainingTimes;

   public static SoundVo init(Sound sound, UserInfo info){
      SoundVo vo = new SoundVo();
      BeanUtils.copyProperties(info,vo);
      BeanUtils.copyProperties(sound,vo);
      vo.setId(info.getId().intValue());
      return vo;
   }
}
